package com.tjtt.gwm.dao.impl;

import java.util.List;
import org.hibernate.Query;
import com.tjtt.gwm.dao.DbDao;
import com.tjtt.tdm.base.BaseHibernateDao;

public class DbDaoImpl extends BaseHibernateDao implements DbDao {

	
	public void deleteData(Object object) {
		this.getHibernateTemplate().delete(object);
	}

	
	public Object getDataById(Class clazz, Long id) {
		return this.getHibernateTemplate().get(clazz, id);
	}

	public void saveObject(Object object) {
		this.getHibernateTemplate().save(object);
	}

	
	public void updateObject(Object object) {
		this.getHibernateTemplate().update(object);
	}
	
	public List queryDataBySql(String sql){
   	 	 Query query = getSession().createSQLQuery(sql);
  	     List list = query.list();
  	     return list;
   }
	
	public void exeSql(String sql){
		 Query query = getSession().createSQLQuery(sql);
		 query.executeUpdate();
	}


}
